
const axios = require('axios') 

exports.getFee = async function () {
  const data = {
    json: true,
    code: 'farmersworld',
    scope: 'farmersworld',
    table: 'config',
    table_key: '',
    lower_bound: '',
    upper_bound: '',
    index_position: 1,
    key_type: '',
    limit: 1,
    reverse: false,
    show_payer: false,
  }
  let fee = 0
  try {
    const result = await axios.post('https://wax.greymass.com/v1/chain/get_table_rows', data)
    if (result.data && result.data.rows && result.data.rows.length > 0) {
      fee = result.data.rows[0].fee
    }
  } catch (error) {
    console.log(error)
  }
  return fee
}
